# _*_ coding:utf-8 _*_
# @Time : 2021/9/17 17:49
# @Author : wsl
# @File : Urllib
# @Project : python  百度翻译的详细翻译  第二次反扒：Cookie
import urllib.request
import urllib.error

url = 'https://item.jd.com/100048172465.html'

headers = {
    # ':Authority': 'weibo.cn',
    # ':Method': 'GET',
    # ':Path': '/5351113868/info',
    # ':Scheme': 'https',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    # 'Accept-Encoding': 'gzip, deflate, br',
    # 'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cache-Control': 'no-cache',
    # cookie携带登录信息
    'Cookie': '_T_WM=63912172934; SCF=Ap4xT0hUv3mhozDMqNXRyzttK_MVNNgxCm-CJKIYyyU_gaPIcnZaCNbZrc2v2LWlwLZdSmlRtMtP_JfISw0T4tc.; SUB=_2A25JcElmDeRhGeNN7lMQ8S3EzTSIHXVqm1curDV6PUJbktAGLVrTkW1NSblrQ01LWEhH8tJ7WGvalF1y9kmRXERh; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9W5wDZfaGjCz7yYwITOT9F6q5JpX5K-hUgL.Fo-0SK2peKeRSon2dJLoIXQLxKqL1hnL1K2LxKqL1KnLB-qLxKBLBonL1h5LxKqL1-BLBK2LxK-LB-qLB.zLxKqLBo5LBoBLxKML1-2L1hBLxK.LBo2LB.e_TBtt; SSOLoginState=1685338422; ALF=1687930422; MLOGIN=1; _TTT_USER_CONFIG_H5=%7B%22ShowMblogPic%22%3A1%2C%22ShowUserInfo%22%3A1%2C%22MBlogPageSize%22%3A10%2C%22ShowPortrait%22%3A1%2C%22CssType%22%3A0%2C%22Lang%22%3A1%7D; M_WEIBOCN_PARAMS=lfid%3D1076033144744040%26luicode%3D20000174',
    'Pragma': 'no-cache',
    'Referer': 'https://weibo.cn/?tf=5_009',
    'Sec-Ch-Ua': '"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"',
    'Sec-Ch-Ua-Mobile': '?1',
    'Sec-Ch-Ua-Platform': '"Android"',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-User': '?1',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0'
}

request1 = urllib.request.Request(url=url, headers=headers)
response = urllib.request.urlopen(request1)
content1 = response.read().decode('utf-8')
# with open('../../image/output/weibo.html', 'w', encoding='utf-8') as fp:
#     fp.write(content1)
print(content1)